#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  yieldsend.py
#       Author @  Huoty
#  Create date @  2015-10-25 21:35:38
#  Description @  
# *************************************************************



# Script starts from here

def Zrange(n):
    i = 0
    while i < n:
        val = yield i
        print "val is", val
        i += 1

zrange = Zrange(5)

print zrange.next()
print zrange.next()
print zrange.send("hello")
print zrange.next()
#print zrange.next()

zrange.close()

print zrange.send("world")
